//设计关于程序界面
// ignore_for_file: camel_case_types, sized_box_for_whitespace

import 'package:flutter/material.dart';
import 'package:project_award_statistics/pages/mobile_material_design/login_page/login_page.dart';
import 'package:project_award_statistics/utils/mobile_material_design/my_button.dart';
import 'package:url_launcher/url_launcher.dart';

class AboutPage_Mobile extends StatelessWidget {
  const AboutPage_Mobile({super.key});

  //设置用于跳转西北民族大学网页的函数
  void launch_xbmu_website() async {
    String url = 'https://www.xbmu.edu.cn';
    final Uri uri = Uri.parse(url); //将url字符串转换为url对象uri
    launchUrl(uri);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: //设置应用标题栏样式
          AppBar(
        backgroundColor: Colors.transparent,
        elevation: 0,
        foregroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: const Text(
          //设置标题栏文字
          "关于程序",
        ),
        actions: [
          //设置右侧退出到主页的按钮
          IconButton(
            onPressed:
                () {
                  Navigator.pushReplacement(  // 设置按钮跳转功能
                  context, 
                  MaterialPageRoute(  
                    builder: (context)=>PopScope(    // 切换页面后彻底销毁当前页面对象               
                      canPop: false,
                      child: LoginPage_Mobile(), 
                    )
                  ),
                );
                },
            icon: const Icon(Icons.exit_to_app), //设置图标
          ),
        ],
      ),

      //设置主体部分
      body: Padding(
        padding: const EdgeInsets.only(top:30.0,left:10,right:10),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Image.asset(
                  "lib/images/northwest_minzu_university_icon.png",
                  width: 100,
                  height: 100,
                ),
                SizedBox(width: 30,),
                Column(   //这子行用于设置"西北民族大学荣誉出品"字样
                  children: [  
                    Text(  
                      "西北民族大学",
                      style: TextStyle(
                        color: Colors.black,
                        fontSize: 30,
                      ),
                    ),
                    SizedBox(height: 12,),  //设置两行字体间的一定间距
                    Text(  
                      "荣誉出品",
                      style: TextStyle(
                        color: Colors.black,
                        fontSize: 28,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ],
                ),
              ],
            ),
            Padding(
              //设置下半段容器
              padding: EdgeInsets.only(left: 15, right: 15),
              child: Text(
                //设置应用介绍文本样式
                "该软件用于西北民族大学电子设计工作室查询个人的获奖信息以及修改个人获奖信息。",
                style: TextStyle(fontSize: 20, color: Colors.black),
              ),
            ),
        
            Padding(
              padding: EdgeInsets.only(bottom: 70),
              child: Container(
                width: 300,
                height: 50,
                child: MyButton(
                  text: "快点击我访问西北民族大学",
                  onPressed: () {
                    launch_xbmu_website();
                  },
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
